# Maintainer: Christoph Reiter <reiter.christoph@gmail.com>

_realname=dulwich
pkgname="python-${_realname}"
pkgver=0.20.14
pkgrel=1
pkgdesc='Pure-Python implementation of the Git file formats and protocols'
arch=('i686' 'x86_64')
url='https://www.dulwich.io'
license=('GPL')
depends=('python')
makedepends=('python-setuptools' 'python-devel')
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('21d6ee82708f7c67ce3fdcaf1f1407e524f7f4f7411a410a972faa2176baec0d')

prepare(){
  cd "${srcdir}/${_realname}-${pkgver}"
}

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  /usr/bin/python setup.py build
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"

  /usr/bin/python setup.py install --root="${pkgdir}" --optimize=1 --skip-build

  # We are missing runtime deps, so don't bother installing the cli tools.
  # dulwich alone is enough to get breezy working.
  rm -Rf "${pkgdir}"/usr/bin

  install -D -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
